package cate.game.play.skill.passive.god;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 攻击前排目标的伤害在104%~112%波动，状态类技能无影响
 */
public class 波动狙击PH extends PassiveHandler {

	private double 下限;

	private double 上限;

	//下限=400&上限=1200
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		下限 = args.getWDouble("下限", 0d);
		上限 = args.getWDouble("上限", 0d);
	}

	@Override
	public void beforeSkillSettleAsActor(SkillActionCtx action, SkillEffect effect, Fighter target) {
		if (!action.getSkill().cfg.isHurtSkill()) {
			return;
		}
		if (target.getPos() > 3) {
			return;
		}
		double changeRate = 下限 + Math.random() * (上限 - 下限);
		effect.getTargetCtx(target).addHpChangeRate(changeRate);
	}
}
